<?php

namespace App\Controller\Pay;

use App\Controller\BaseController;
use App\Request\Pay\CheckAppleOrderRequest;
use App\Request\Pay\CheckGoogleOrderRequest;
use App\Services\Pay\RechargeService;
use Hyperf\Di\Annotation\Inject;

class CheckRechargeOrderController extends BaseController
{
    #[Inject]
    public RechargeService $rechargeService;


    /**
     * Note - apple订单校验
     * DateTime 2024/8/26 10:52
     * User Admin
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function appleOrder(CheckAppleOrderRequest $request)
    {
        $params = $this->request->post();
        $request->execute($params);
        $this->rechargeService->appleOrder($params);
        return $this->return(formatData(['result' => 1]));

    }


    /**
     * Note - google订单校验
     * DateTime 2024/8/26 10:36
     * User Admin
     */
    public function googleOrder(CheckGoogleOrderRequest $request)
    {
        $params = $this->request->post();
        $request->execute($params);
        $this->rechargeService->googleOrder($params);
        return $this->return(formatData(['result' => 1]));

    }


    /**
     * Note - 印度第三方订单校验
     * DateTime 2024/8/26 11:16
     * User Admin
     * @return string
     */
    public function indoOrder()
    {
        $params = $this->request->post();
        $this->rechargeService->indoOrder($params);
        return 'success';

    }

}